#ifndef _ISO_BAND_POLYGON_H_
#define _ISO_BAND_POLYGON_H_

#include "IsoBandUtil.h"
#include <iomanip>

struct EdgesInfo
{
    std::vector<double> path;
    int moveX;
    int moveY;
    std::string enter;
};

struct Edges
{
    std::unordered_map<string, EdgesInfo> data;

    void remove(string k)
    {
        data.erase(k);
    }

    bool isObject(string key)
    {
        return data.find(key) != data.end();
    }

    EdgesInfo find(string k)
    {
        return data[k];
    }
};

struct Cell
{
    int cval;
    Edges edges;
    double x0, x1, x2, x3;
    int x, y;
};

vector<IsoBandPoint> entry_coordinate(double x, double y, int mode, const vector<double> &path);

vector<IsoBandPoint> skip_coordinate(double x, double y, int mode);

bool requireFrame(std::vector<double> &gridData, int width, int height, double lowerBound, double upperBound);
vector<IsoBandPolygon> traceBandPaths(std::vector<double> &gridData, int width, int height,
                                      vector<vector<Cell>> &cellGrid,
                                      double minV, double maxV);

vector<IsoBandPolygon> traceLinePaths(std::vector<double> &gridData, int width, int height,
                    vector<vector<Cell>> &cellGrid, double threshold, bool linearRing, bool noFrame);
#endif
